import { useRoutes } from "react-router-dom"; //集中式路由
import Home from "../Home"; //页面入口文件
import Login from "../Login"; //登录页面
import Errors from "../errors"; //404页面
import Visitorindex from "../views/home/index"; //首页
import VisitorList from "../views/Visitor-log/VisitorList"; //访客列表
import VisitorAdd from "../views/Visitor-log/VisitorAdd"; //访客添加修改
import VisitorPrincipal from "../views/Visitor-log/VisitorPrincipal"; //负责人

const Routes = ()=>{
  return useRoutes([
    {
      path:'/',
      element:<Login />
    },
    {
      path:'/login',
      element:<Login />
    },
    {
      path:'/index', //父路由
      element:<Home />,
        children:[ //子路由
          {
            path:'Visitorindex',
            index:true,
            element:<Visitorindex />
          },
          {
            path:'VisitorList',
            element:<VisitorList />
          },
          {
            path:'VisitorAdd',
            element:<VisitorAdd />
          },
          {
            path:'VisitorPrincipal',
            element:<VisitorPrincipal />
          },
        ]
    },
    {
      path:'*',
      element:<Errors />
    },
  ])
}

export default Routes;